﻿using System;
using hr_1.Model;

namespace hr_1.ViewModel
{
    public class WorkActivityViewModel : ViewModelBase
    {
        #region Fields

        readonly WorkActivity _workActivity = new WorkActivity();

        #endregion // Fields

        #region Constructor

        public WorkActivityViewModel() { }

        public WorkActivityViewModel(WorkActivity workActivity)
        {
            if (workActivity == null)
                throw new ArgumentNullException("workActivity");

            _workActivity = workActivity;
        }

        #endregion // Constructor

        #region workActivity Properties

        public int WorkActivityId
        {
            get { return _workActivity.WorkActivityId; }
        }

        public string Contract
        {
            get { return _workActivity.Contract; }
            set
            {
                if (value == _workActivity.Contract)
                    return;
                _workActivity.Contract = value;
                base.OnPropertyChanged("Contract");
            }
        }

        public string DataHire
        {
            get { return _workActivity.DateHire; }
            set
            {
                if (value == _workActivity.DateHire)
                    return;
                _workActivity.DateHire = value;
                base.OnPropertyChanged("DateHire");
            }
        }

        public string DateDismissal
        {
            get { return _workActivity.DateDismissal; }
            set
            {
                if (value == _workActivity.DateDismissal)
                    return;
                _workActivity.DateDismissal = value;
                base.OnPropertyChanged("DateDismissal");
            }
        }

        public string Department
        {
            get { return _workActivity.Department; }
            set
            {
                if (value == _workActivity.Department)
                    return;
                _workActivity.Department = value;
                base.OnPropertyChanged("Department");
            }
        }

        public string PositionGroup
        {
            get { return _workActivity.PositionGroup; }
            set
            {
                if (value == _workActivity.PositionGroup)
                    return;
                _workActivity.PositionGroup = value;
                base.OnPropertyChanged("PositionGroup");
            }
        }
        public string Position
        {
            get { return _workActivity.Position; }
            set
            {
                if (value == _workActivity.Position)
                    return;
                _workActivity.Position = value;
                base.OnPropertyChanged("Position");
            }
        }
        public string Salary
        {
            get { return _workActivity.Salary; }
            set
            {
                if (value == _workActivity.Salary)
                    return;
                _workActivity.Salary = value;
                base.OnPropertyChanged("Salary");
            }
        }
        public string Rate
        {
            get { return _workActivity.Rate; }
            set
            {
                if (value == _workActivity.Rate)
                    return;
                _workActivity.Rate = value;
                base.OnPropertyChanged("Rate");
            }
        }
        public string Experience
        {
            get { return _workActivity.Experience; }
            set
            {
                if (value == _workActivity.Experience)
                    return;
                _workActivity.Experience = value;
                base.OnPropertyChanged("Experience");
            }
        }

        public int EmployeeNumber
        {
            get { return _workActivity.EmployeeNumber; }
            set
            {
                if (value == _workActivity.EmployeeNumber)
                    return;
                _workActivity.EmployeeNumber = value;
                base.OnPropertyChanged("EmployeeNumber");
            }
        }

        #endregion // workActivity Properties

        public void Save()
        {
            _workActivity.Save();
        }
    }
}
